<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>

<script type="text/javascript">
	
	$(document).ready(function(){
	  var num        = 1;
	  $('.addBoxSelect').click(function(){
	 
	 
	 	$clones = $('div.contain:eq(0)').clone();
		
		$('div.select').append($clones);
		
	 });
	  $('.addBoxWhere').click(function(){
	   
	 	$clones = $('#inputwhere'+ num ).clone();
		$('div.where').append($clones);
		$num++;
	 });
	 
	 $('#input' + remove).click(function(){
		
		$('#inputwhere.contain2').remove();
	 });

	
	});
	function chk_all(){   
    var x=document.getElementsByTagName("input");   
    for(i=0;i<=x.length;i++){   
        if(x[i].type=="checkbox"&&x[i].name=="checkselect2"){   
            x[i].checked=true;   
        }   
    }   
}   
function unchk_all(){   
    var x=document.getElementsByTagName("input");   
    for(i=0;i<=x.length;i++){   
        if(x[i].type=="checkbox"&&x[i].name=="checkselect2"){   
            x[i].checked=false;   
        }   
    }   
}   


</script>

</head>

<body>
<form name="filter" method="post" action="">
  <input type="checkbox" name="checkselect" value="checkbox">Select

  <a href="javascript:chk_all();">Check All</a>    
  <a href="javascript:unchk_all();">Uncheck All </a> <br>

	
	<input id=checkselect type="checkbox" name="checkselect2" value="checkselect"><br>
    <div class="select">
    <div class="contain">
	<select name="listselect" id="listselect">
    </select>
    
	<select name="functionselect">
	
	</select>
	
	<input type="text" name="textselect">
	
	</div>
	</div>
	
    <input type="button" class="addBoxSelect" value="add"><br>
	
	<input type="checkbox" name="checkwhere" value="checkwhere">Where<br>
	<input type="button" class="addBoxWhere" value="add"><br>
   <div class="where" >
    <div id="inputwhere1" class="contain2" >
	<select name="listwhere" id="listwhere">
	</select>

	<select name="functionwhere">
 	</select>
	
  <input type="text" name="textwhere">
  <input name="delwhere"  class = "Removewhere" type="button" id="input1" value="Del">
	</div>
	</div>

	 <input type="button" class="addBoxWhere" value="add"><br>
  <br> <input type="checkbox" name="checkgroupby" value="checkgroupby"> 
  Groupby  <br>

    <input id = select type="checkbox" name="checkbox" value="checkbox"> <br>
  
  <input type="checkbox" name="checkbox34" value="checkbox"> 
  Having   <br>
	<input type="button" class="addBoxHaving" value="add"><br>
  <select name="listhaving" id="listhaving">
  </select>
  <select name="functionhaving">
  </select>
  <input type="text" name="texthaving">
  <input name="delhaving" type="button" id="delhaving" value="Del">

    <br>
   <input type="checkbox" name="checkorderby" value="checkorderby">
  Orderby  <br>

    <select name="listorderby" id="listorderby">
    </select>
   
    <select name="functionorderby">
    </select>
   
    <input name="delorderby" type="button" id="delorderby" value="Del">  <br>
 

    <input type="submit" name="Submit" value="Submit">

</form>
</body>
</html>
